package com.mo.modular.tv.view;

import java.text.CollationKey;
import java.text.Collator;


public class SearchContentList implements Comparable<Object> {
	private long id;

	private String name;

	private String type;

	private String iconUrl;

	private String imgUrl;

	private String playUrl;
	
	//private String hasVideo;

	private String description;

	private String publishtime;

	//private String packageName;

//	private long totalSize;

//	private String keyword;

	//private String hasVolume;

	//private String isp_menu_code;

	private String link_url;
	
	private String isMonitor;

	//private String is_autoplay;
	//private String fake_price;
	//private String sale_price;
	//private String post_price;


   /*public String getPost_price() {
		return post_price;
	}

	public void setPost_price(String post_price) {
		this.post_price = post_price;
	}

	public String getIs_autoplay() {
		return is_autoplay;
	}

	public void setIs_autoplay(String is_autoplay) {
		this.is_autoplay = is_autoplay;
	}

	public String getFake_price() {
		return fake_price;
	}

	public void setFake_price(String fake_price) {
		this.fake_price = fake_price;
	}

	public String getSale_price() {
		return sale_price;
	}

	public void setSale_price(String sale_price) {
		this.sale_price = sale_price;
	}
	
	public String getLink_url() {
		return link_url;
	}

	public void setLink_url(String linkUrl) {
		link_url = linkUrl;
	}

	public String getHasVolume() {
		return hasVolume;
	}

	public void setHasVolume(String hasVolume) {
		this.hasVolume = hasVolume;
	}

	public String getIsp_menu_code() {
		return isp_menu_code;
	}

	public void setIsp_menu_code(String isp_menu_code) {
		this.isp_menu_code = isp_menu_code;
	}
*/
/*	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public long getTotalSize() {
		return totalSize;
	}

	public void setTotalSize(long totalSize) {
		this.totalSize = totalSize;
	}*/

	public long getId() {
		return id;
	}

	public String getLink_url() {
		return link_url;
	}

	public void setLink_url(String link_url) {
		this.link_url = link_url;
	}

	public String getIsMonitor() {
		return isMonitor;
	}

	public void setIsMonitor(String isMonitor) {
		this.isMonitor = isMonitor;
	}

	public void setPlayUrl(String playUrl) {
		this.playUrl = playUrl;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getIconUrl() {
		return iconUrl;
	}

	public void setIconUrl(String iconUrl) {
		this.iconUrl = iconUrl;
	}

	public String getImgUrl() {
		return imgUrl;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}

	public String getPlayUrl() {
		return playUrl;
	}

	/*public void setPlayUrl(String playUrl) {
		this.playUrl = playUrl;
		hasVideo = playUrl == null || "".equals(playUrl) ? "0" : "1";
	}
	
	public String getHasVideo() {
		return hasVideo;
	}

	public void setHasVideo(String hasVideo) {
		this.hasVideo = hasVideo;
	}*/
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPublishtime() {
		return publishtime;
	}

	public void setPublishtime(String publishtime) {
		this.publishtime = publishtime;
	}

	/*public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}*/

	@Override
	public boolean equals(Object obj) {
		return obj instanceof SearchContentList
				&& this.id == ((SearchContentList) obj).getId();
	}

	@Override
	// 时间倒序，名称按拼音首字母正序。
	public int compareTo(Object o) {
		Collator collator = Collator.getInstance(java.util.Locale.CHINESE);
		if (this.equals(o)) {
			return 0;
		} else if (o != null && o instanceof SearchContentList) {
			SearchContentList sc = (SearchContentList) o;
			int i = this.getPublishtime().compareTo(sc.getPublishtime());
			if (i > 0) {
				return 1;
			} else if (i == 0) {
				CollationKey k1 = collator.getCollationKey(this.getName()
						.toUpperCase());
				CollationKey k2 = collator.getCollationKey(sc.getName()
						.toUpperCase());
				return -k1.compareTo(k2);
			} else {
				return -1;
			}
		} else {
			return 1;
		}
	}

	
	public static void main(String[] args) {
		Collator collator = Collator.getInstance(java.util.Locale.CHINA);
		CollationKey k1 = collator.getCollationKey("a中间");
		CollationKey k2 = collator.getCollationKey("A中间");
		System.out.println(k1.compareTo(k2));
	}
}
